home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / pc / files / t_unix / j109lxa4.tar / proc.h < prev    next >
C/C++ Source or Header  |  1994-06-04  |  3KB  |  96 lines

  1. #ifndef    _PROC_H
  2. #define    _PROC_H
  3.  
  4. #include <setjmp.h>
  5.  
  6. #ifndef _MBUF_H
  7. #include "mbuf.h"
  8. #endif
  9.  
  10. #ifndef    _TIMER_H
  11. #include "timer.h"
  12. #endif
  13.  
  14. #ifdef __GNUC__
  15. struct session;            /* forward declaration */
  16. #endif
  17.  
  18. #define    OUTBUFSIZE    512    /* Size to be malloc'ed for outbuf */
  19.  
  20. /* Kernel process control block */
  21. #define    PHASH    16        /* Number of wait table hash chains */
  22. struct proc {
  23.     struct proc *prev;    /* Process table pointers */
  24.     struct proc *next;    
  25.  
  26.     jmp_buf env;        /* Process state */
  27.     char i_state;        /* Process interrupt state */
  28.  
  29.     unsigned short state;
  30. #define    READY    0
  31. #define    WAITING    1
  32. #define    SUSPEND    2
  33. #ifdef __STDC__
  34.     volatile
  35. #endif
  36.     void *event;        /* Wait event */
  37.     int16 *stack;        /* Process stack */
  38.     unsigned stksize;    /* Size of same */
  39.     char *name;        /* Arbitrary user-assigned name */
  40.     int retval;        /* Return value from next pwait() */
  41.     struct timer alarm;    /* Alarm clock timer */
  42.     struct mbuf *outbuf;    /* Terminal output buffer */
  43.     int input;        /* standard input socket */
  44.     int output;        /* standard output socket */
  45.     int iarg;        /* Copy of iarg */
  46.     void *parg1;        /* Copy of parg1 */
  47.     void *parg2;        /* Copy of parg2 */
  48.     int freeargs;        /* Free args on termination if set */
  49. #ifdef UNIX
  50.     struct session *session; /* for session manager - sigh */
  51. #endif
  52. };
  53. #define NULLPROC (struct proc *)0
  54. extern struct proc *Waittab[];    /* Head of wait list */
  55. extern struct proc *Rdytab;    /* Head of ready list */
  56. extern struct proc *Curproc;    /* Currently running process */
  57. extern struct proc *Susptab;    /* Suspended processes */
  58. extern int Stkchk;        /* Stack checking flag */
  59.  
  60. #ifdef UNIX
  61. #define psignal j_psignal
  62. #endif
  63.  
  64. /* In  kernel.c: */
  65. void alert __ARGS((struct proc *pp,int val));
  66. void chname __ARGS((struct proc *pp,char *newname));
  67. void killproc __ARGS((struct proc *pp));
  68. void killself __ARGS((void));
  69. struct proc *mainproc __ARGS((char *name));
  70. struct proc *newproc __ARGS((char *name,unsigned int stksize,
  71.     void (*pc) __ARGS((int,void *,void *)),
  72.     int iarg,void *parg1,void *parg2,int freeargs));
  73. int psignal __ARGS((volatile void *event,int n));
  74. int pwait __ARGS((volatile void *event));
  75. void resume __ARGS((struct proc *pp));
  76. void suspend __ARGS((struct proc *pp));
  77.  
  78. /* In ksubr.c: */
  79. void chkstk __ARGS((void));
  80. void kinit __ARGS((void));
  81. unsigned phash __ARGS((volatile void *event));
  82. void psetup __ARGS((struct proc *pp,int iarg,void *parg1,void *parg2,
  83.     void  __ARGS(((*pc) __ARGS((int,void *,void *)) )) ));
  84. #ifdef    AMIGA
  85. void init_psetup __ARGS((struct proc *pp));
  86. #endif
  87.  
  88. /* Stack background fill value for high water mark checking */
  89. #define    STACKPAT    0x55aa
  90.  
  91. /* Value stashed in location 0 to detect null pointer dereferences */
  92. #define    NULLPAT        0xdead
  93.  
  94. #endif    /* _PROC_H */
  95.  
  96.